package org.example.controller;

import com.alibaba.fastjson.JSON;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
public class TestController {
    @Autowired
    RabbitTemplate rabbitTemplate;
    @GetMapping("/hh")
    public String messg(){
        Map<String,Object> map=new HashMap<>();
        map.put("name","张三");
        map.put("age",18);
        rabbitTemplate.convertAndSend("object.queue",map);
        return "消息发送成功";
    }
}
